# 一方库
from myutils.model_save_load import model_load
from myutils.path_data import get_path,load_data




from .dataset import Dataset_one
from .model import Model_one
from .loss import Loss_one



# 三方库
import torch.nn as nn
from torch.utils.data import DataLoader
from torchvision import transforms



def get_param_one(model_name,pre_model_name,batch_size,device,is_test,use_mydata,use_transformer,use_shape,use_location):
    """获得one网络的所有实体"""
    path_txt,path_root=get_path(use_mydata,is_test)
    label_count = load_data(path_txt,path_root)

    dataset_one = Dataset_one(path_txt,label_count,is_test,use_shape,use_location)
    dataLoader_one = DataLoader(dataset=dataset_one,batch_size=batch_size,drop_last=not is_test,shuffle=False)
    model_one = Model_one(pre_model_name,use_transformer).to(device)
    loss_one  = Loss_one(use_location)

    model_load(model_one,model_name,device=device)

    return (dataset_one,dataLoader_one,model_one,loss_one)